<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>栏目管理</title>
<link rel="stylesheet" type="text/css" href="template/admin.css"/>
<script type="text/javascript" src="template/images/jquery.js"></script>
<style type="text/css">
body{margin:20px;}
</style>
<script type="text/javascript">
function show_list(n){
$(n).parent().parent('#border').parent('#catagory').find('#catagory').toggle();
}
</script>
</head>

<body>
<div class="div_out">
 <div class="position"><h2>当前位置 > <a href="admin_catagory.php">栏目管理</a> > <?php if($parent){echo '下级栏目管理';}else{echo '顶级栏目管理';}?></h2></div>
 <div class="lang"><span>当前的语言:</span>
 
  <?php
 $cache_file=DATA_PATH."cache/lang_cache.php";
 $cache_arr=read_cache($cache_file,'lang_cache');
 if(!empty($cache_arr)){
 foreach($cache_arr as $k=>$v){
  if(!$v['lang_is_use']){continue;}
 ?>
 <a href="?lang=<?php echo $v['lang_tag'];?>" class="<?php if($GLOBALS['lang']==$v['lang_tag']){echo 'hover';}?>"><?php echo $v['lang_name'];?></a>
 <?php
 }
 }
 ?>
 
</div>
</div><!--导航-->

<div class="caozuo_nav">
<ul>
 <li class="<?php if($GLOBALS['action']=='catagory'){echo 'hover';}?>"><a href="?action=catagory&lang=<?php echo $GLOBALS['lang'];?>">管理栏目</a></li>
 <li class="<?php if($GLOBALS['action']=='category_add'){echo 'hover';}?>"><a href="?action=category_add&lang=<?php echo $GLOBALS['lang'];?>">添加顶级栏目</a></li>
 <li class="<?php if($GLOBALS['action']=='cache_cate'){echo 'hover';}?>"><a href="?action=cache_cate&lang=<?php echo $GLOBALS['lang'];?>">更新栏目缓存</a></li>
 <li ><span style="color:#FF0000">可通过‘模板生成管理’——‘输出设置’配置输出栏目内容</span></li>
</ul>
<div class="clear"></div>
</div><!--小操作导航-->
<div class="div_out" id="tb">
<div id="sys">
<form name="maininfo" method="post" enctype="multipart/form-data" class="form">
 <table cellpadding="0" cellspacing="0" width="100%">
 	<thead>
		<tr><th style="text-align:left; padding-left:5px; font-weight:normal">请先添加顶级栏目,如果已经添加了栏目没显示请更新下栏目缓存<span style="color:red;padding-left:15px;">删除栏目将会连同子栏目一起删除</span></th></tr>
	</thead>
	<tbody>

		<tr>
		<td style="border-bottom:none">
		<?php
		if(!empty($cate_list)){
		foreach($cate_list as $key=>$value){
			if($value['cate_parent']==0){
		?>
			<div id="catagory">
			<div id="border" style="border-bottom:1px dashed #ccc; padding:2px 0; ">
				<div class="left" id="show" style="cursor:pointer"><span class="exp" onclick="show_list(this);">&nbsp;</span><span class="cata"><?php echo "<a href=\"".CMS_SELF."show_list.php?id={$value['id']}\" target=\"_blank\">{$value['cate_name']}</a>(<span style=\"color:#999\">排序</span>{$value['cate_order']}&nbsp;<span style=\"color:#999\">模板id</span>:{$value['id']})";
				$cate_nav=empty($value['cate_nav'])?array(''):explode(',',$value['cate_nav']);
				echo in_array('2',$cate_nav)?"<span style=\"color:#3366FF\">导航中部显示</span>":"";
				echo in_array('3',$cate_nav)?"<span style=\"color:#FFCC66\">导航底部显示</span>":"";

				if($value['cate_hide']){
					echo "<span style=\"color:red; padding:0 3px;\">隐藏</span>";
				}
				$href2=($value['cate_channel']==1)?"href=\"admin_content_alone.php?action=content_list\"":"href=\"admin_content.php?action=content_list&id={$value['cate_channel']}&cate={$value['id']}&lang={$value['lang']}\"";
				?></span></div><div class="right"><span class="caozuo"><a href="?action=child&parent=<?php echo $value['id'];?>&channel_id=<?php echo $value['cate_channel'];?>&lang=<?php echo $GLOBALS['lang']?>">增加下级栏目</a><?php if($value['cate_channel']!='-9'){?>|<a <?php if($value['cate_channel']==1){?>href="admin_content_alone.php?cate_id=<?php echo $value['id'];?>&lang=<?php echo $value['lang'];?>"<?php }else{?>href="admin_content.php?action=add&id=<?php echo $value['cate_channel'];?>&cate=<?php echo $value['id'];?>&lang=<?php echo $lang;?>"<?php }?>>添加内容</a>|<a <?php echo $href2;?>>查看内容</a><?php }?>|<a href="?action=xg&lang=<?php echo $GLOBALS['lang'];?>&id=<?php echo $value['id'];?>&parent=<?php echo $GLOBALS['parent'];?>">修改栏目</a>|<a href="?action=move_cate&cate=<?php echo $value['id'];?>&lang=<?php echo $lang;?>">移动栏目</a>|<a href="javascript:if(confirm('确定要删除么,删除后不可恢复!')){location.href='admin_catagory.php?action=del&lang=<?php echo $GLOBALS['lang'];?>&id=<?php echo $value['id'];?>&parent=<?php echo $GLOBALS['parent'];?>';}  ">删除栏目</a></span></div>
				<div style="clear:both"></div>
				</div>
				<?php
				$parent_id=$value['id'];
			unset($cate_list[$key]);
			get_cate_list($cate_list,$parent_id,$value['haschild']);
				?>
				
			</div>
			
			<?php
			}
			}
			 }?>
			
		</td>
		</tr>	

	</tbody>
 </table>
  <div class="btn" style="margin-top:10px">
<input type="hidden" name="action" value="add_inc"/><input type="hidden" name="lang" value="<?php echo $lang;?>"/>
 </div>
 </form>
 </div> <!--内容切换-->


 </div>


</body>
</html>
